package me.zhengjie.cron;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.domain.PlcErrorService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RequiredArgsConstructor
public class PlcErrorCron {

    private final PlcErrorService plcErrorService;

    /**
     * 机台报警上报定时器
     */
    @Scheduled(fixedDelay = 5000)
    public void checkErrorInfoCron() {
        plcErrorService.checkInfoAndReport();
    }

    /**
     * 机台状态变更上报定时器
     */
    @Scheduled(fixedDelay = 5000)
    public void checkStatusChangeCron() {
        plcErrorService.checkStatusAndReport();
    }

    /**
     * 光栅报警信息上传定时器
     */
    @Scheduled(fixedDelay = 1000)
    public void checkGratingAlertsCron() {
        plcErrorService.checkGratingAlertsAndReport();
    }
}
